#pragma once
#ifndef __VERTEXBUFFERPART_H__
#define __VERTEXBUFFERPART_H__

#include "Utility.h"

#include "../util/D3DCommon.h"
#include "../util/PreDeclare.h"
#include "../mesh/MeshPartInfo.h"

namespace WindGE
{
	class WIND_CORE_API VertexBufferPart
	{
	public:
		VertexBufferPart();
		~VertexBufferPart();

		bool init(RenderDevicePtr renderDevice, std::initializer_list<bool> isDynamicVec,
				  bool hasIndex = true, bool indexDynamic = false);

		bool build(MeshPartPtr meshPart);

		void bind_vertex_buffer(unsigned int slot, unsigned int offset);
		void bind_vertex_buffer(const std::string& slotName, unsigned int offset);

		void bind_index_buffer(unsigned int offset);

		bool update_vertex_buffer(unsigned int slot, unsigned int size, void* datas);
		bool update_index_buffer(unsigned int size, void* datas);

	private:
		RenderDevicePtr										render_device_;
		VertexBufferPtr										ib_;
		std::vector<VertexBufferPtr>						vb_list_;
		std::unordered_map<std::string, unsigned int>		vs_names_;
		MeshPartInfo										part_info_;
	};

}//end namespace WindGE

#endif // !__VERTEXBUFFERPART_H__


 